package com.iplant.basic.serviceImpl.dao.bfc;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.iplant.base.utils.annotation.dao.DBBaseDAO;
import com.iplant.basic.service.po.bfc.BFCHomePageModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;

import com.iplant.base.po.OutResult;
import com.iplant.base.po.Pagination;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.general.StringUtils;
import com.iplant.base.utils.sql.BaseDAO;
import com.iplant.basic.service.po.bfc.BFCHomePageGroup;
import com.iplant.basic.service.po.bms.BMSEmployee;

@DBBaseDAO(BFCHomePageGroup.class)
public class BFCHomePageGroupDAO extends BaseDAO {

    private static Logger logger = LoggerFactory.getLogger(BFCHomePageGroupDAO.class);

    private static BFCHomePageGroupDAO Instance;


    public List<BFCHomePageGroup> BFC_SelectHomePageGroupAll(BMSEmployee wLoginUser, String wProjectName, int wType,
                                                             int wActive, String wName,

                                                             Pagination wPagination, OutResult<Integer> wErrorCode) {
        Map<String, Object> wParams = new HashMap<>();
        wParams.put("ProjectName", wProjectName);
        wParams.put("Type", wType);
        wParams.put("Active", wActive);
        wParams.put("Name", wName);
        return this.SelectPOList(wLoginUser, wParams, wPagination, wErrorCode);
    }


    public int Update(BMSEmployee wLoginUser, BFCHomePageGroup wBFCHomePageGroup, OutResult<Integer> wErrorCode) {
        int wResult = 0;
        try {

            wErrorCode.set(0);

            wBFCHomePageGroup.setUserInfo(wLoginUser);

            wResult = this.UpdatePo(wLoginUser, wBFCHomePageGroup, wErrorCode);

        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e.toString());
        }
        return wResult;
    }

    private BFCHomePageGroupDAO() {
        super("");
        this.Init();
    }

    public static BFCHomePageGroupDAO getInstance() {
        if (Instance == null)
            Instance = new BFCHomePageGroupDAO();
        return Instance;
    }

}
